<%@include file="top.jsp"%>
<jsp:useBean id="user" type="mvc.User" scope="session" />

<%
String username = user.getUsername();

if(!(!username.equals("") && user.isAdmin()))
	out.println("You have to log in and be an admin to see this page!<br><a href=\"/mvcjsp/login.jsp\">To Login Page</a>");
else{
	//out.println("Logged in as " + username + "<br><a href=\"/servlet/mvc.Servl?state=logout\">Logout</a>");

%>

<center>
<table width="560" border="0">
	<tr>
      <td><h3>Add New User</h3><hr style="border:dashed #676767; border-width:1px 0 0 0; height:1;"></td>
    </tr>
</table>
<table width="560" border="0">
	<tr>
      <td width="560" align="left">
<FORM name="loginform" method="post" action="/servlet/mvc.Servl?state=adduser">
<INPUT type="text" name="addusername" size="20">Username<br>
<INPUT type="text" name="addfirstname" value="" size="20">First name<br>
<INPUT type="text" name="addlastname" value="" size="20">Last name<br>
<INPUT type="text" name="addemail" value="" size="20">Email<br>
<INPUT type="checkbox" name="addisadmin" size="20">Admin<br><br>
<INPUT type="submit" name="add" value="Add User"></FORM>
<%if(request.getAttribute("errorMessage")!=null)
out.println(request.getAttribute("errorMessage"));%>
 </td>
</tr>
</table>
<%}%>

<%@include file="bottom.jsp"%>